package renguanyu.app.auth4fx.model.role;

import javafx.beans.property.BooleanProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;

import java.util.StringJoiner;

public class RoleVo {

    private StringProperty id;
    private BooleanProperty selected;
    private StringProperty name;
    private StringProperty permission;

    public RoleVo() {
        id = new SimpleStringProperty();
        selected = new SimpleBooleanProperty(false);
        name = new SimpleStringProperty();
        permission = new SimpleStringProperty();
    }

    public String getId() {
        return id.get();
    }

    public StringProperty idProperty() {
        return id;
    }

    public void setId(String id) {
        this.id.set(id);
    }

    public String getName() {
        return name.get();
    }

    public StringProperty nameProperty() {
        return name;
    }

    public void setName(String name) {
        this.name.set(name);
    }

    public String getPassword() {
        return permission.get();
    }

    public StringProperty passwordProperty() {
        return permission;
    }

    public void setPassword(String password) {
        this.permission.set(password);
    }

    public boolean isSelected() {
        return selected.get();
    }

    public BooleanProperty selectedProperty() {
        return selected;
    }

    public void setSelected(boolean selected) {
        this.selected.set(selected);
    }

    @Override
    public String toString() {
        return new StringJoiner(", ", RoleVo.class.getSimpleName() + "[", "]")
                .add("id=" + id)
                .add("selected=" + selected)
                .add("name=" + name)
                .add("permission=" + permission)
                .toString();
    }
}
